<?php

namespace App\Admin\Models;


use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;

class CustomerModel extends Model
{
      protected $table = 'customers';
      
      public function __construct() {
          $this->timestamps = false;
      }
      
      public function getCustomerList(){
          $oList =  DB::table('customers')->get();
           $aList = array();
           foreach($oList as $oOne){
               $aList[$oOne->id] = $oOne->company;
           }
           return $aList;
      }
      
      public function getCustomer($id=0){
          if($id>0)
          {
              return DB::table($this->table)->where('id',$id)->first();
          }
          else{
              return false;
          }
      }
      public function updateCustomer($aCustomer){
          return DB::table($this->table)->where("id",$aCustomer['id'])->update($aCustomer);
      }
      
}
